package view;

import controller.FirewallSession;
import server.RulesTableType;

/**
 * Class is 
 *
 */
public class RulesStandartTable extends AbstractRulesTable
{	
	/**
	 * Serial version ID - for serialization
	 */
	private static final long serialVersionUID = -3151558044750502574L;

	/**
	 * Column names
	 */
	private final static String columnNames[] = 
		{"Id", "IP", "Port", "Protocol", "Action" };
	
	/**
	 * Current standart rule table in IN directions.
	 */
	public static RulesStandartTable currentInRulesTable = null;
	
	/**
	 * Current standart rule table in OUT directions.
	 */
	public static RulesStandartTable currentOutRulesTable = null;
	
	/**
	 * C'tor - Table with specified controller and direction is created.
	 * @param ui	- the controller for the system actions
	 */
	public RulesStandartTable(RulesTableType type, FirewallSession UI)
	{
		super(type, Settings.DEFAULT_RULES_WINDOW_DEPTH, columnNames.length, UI);
		
		switch(type)
		{
		/* Table for IN rules */
		case IN:
			currentInRulesTable = this;
			break;
		/* Table for OUT rules */
		case OUT:
			currentOutRulesTable = this;
			break;
		}
		
		/* Fill the tables with data from FW */
		build();
	}

	/**
	 * Returns the table columns names
	 * @return - the table columns names
	 */
	protected String[] getColumnsNames() 
	{
		return columnNames;
	}
}
